package com.hxzy.controller;

import com.hxzy.common.enums.AckCode;
import com.hxzy.common.vo.R;
import com.hxzy.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 功能描述
 *
 * @author tonneyyy
 */
@RestController
public class CategoryController {

    @Autowired
    private CategoryService categoryService;


    /**
     * 根据分类的id查询名称
     * @param ids
     * @return
     */
    @GetMapping(value = "/category/names")
    public R findNameByCategoryIds(Integer[] ids){
        List<String> names=this.categoryService.findNameByCategoryIds(ids);
        if (names == null || names.size() < 1) {
            return  R.build(AckCode.NOT_FOUND_DATA);
        }
        return R.okHasData(names);
    }

}
